<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>搜索页面</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .nav_top {
            background-color: #f5f5f5;
        }

        .wrap {
            width: 1220px;
            margin: 0 auto;
        }

        .header .wrap {
            overflow: hidden;
            padding-top: 10px;
        }

        .header-logo {
            float: left;
            width: 250px;
            display: block;
        }

        .header-logo img {
            width: 225px;
            margin-top: 10px;
        }

        .header-search {
            width: 500px;
            margin-top: 15px;
            float: left;
        }

        .header-search-text {
            width: 406px;
            height: 28px;
            border: 2px solid #c81523;
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            outline: none;
            float: left;
            padding: 0 5px
        }

        .header-search-btn {
            width: 78px;
            height: 32px;
            font-size: 14px;
            font-weight: 700;
            color: #fff;
            cursor: pointer;
            border: 3px solid #c81523;
            outline: none;
            background: #c81523;
            font-family: "微软雅黑";
            line-height: 22px;
        }

        .header-search-hot {
            color: #999;
            font-size: 12px;
            margin-top: 5px;
        }

        .header-info {
            margin-top: 15px;
            margin-left: 20px;
            float: left
        }

        .header-info a {
            padding: 8px 12px;
            border: 1px solid #E3E3E3;
            background-color: #F7F7F7;
            color: #666;
            margin-right: 12px;
            cursor: pointer;
            display: inline-block;
            text-decoration: none;
            font-size: 12px;
        }

        .product {
            margin-bottom: 50px;
        }

        .product span {
            width: 100%;
            display: inline-block;
            overflow: hidden;
            /* white-space: pre-wrap; */
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .heading {
            border-bottom: 1px solid #ddd;
            margin-bottom: 30px;
        }

        .heading h2 {
            font-size: 24px;
            padding-bottom: 10px;
        }
    </style>
</head>
<body>
<div class="container-fluid nav_top">
    <div class="navbar-header">
        <a class="navbar-brand" th:href="@{/}">淘淘商城</a>
    </div>
    <div>
        <ul class="nav navbar-nav navbar-right">
            <li class="active" th:if="${session.user}==null"><a th:href="@{/login}">亲，请登录</a></li>
            <li class="dropdown" th:unless="${session.user}==null">
                <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                   aria-expanded="false" href="#">
                    <span th:text="'欢迎您:' + ${session.user.username} + '!'"></span><span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <li><a th:href="@{/user/logout}">退出</a></li>
                </ul>
            </li>
            <li>
                <a th:href="@{/user/cartList}">购物车</a>
            </li>
            <li>
                <a th:href="@{/user/order}">我的订单</a>
            </li>
        </ul>
    </div>
</div>

<!-- 头部 -->
<div class="header">
    <div class="wrap">
        <a class=" header-logo" th:href="@{/}">
            <img src="../static/image/logo.png" th:src="@{/image/logo.png}" alt="在线商城"></a>
        <div class="header-search">
            <form th:action="@{/search}" method="post">
                <input type="text" name="product" class="header-search-text">
                <input class="header-search-btn" type="submit" value="搜索">
            </form>
            <p class="header-search-hot">热门搜索：新款连衣裙 四件套 潮流T恤 时尚女鞋 短裤 半身裙 </p>
        </div>
        <div class="header-info">
            <a href="#">会员中心</a>
            <a th:href="@{/user/cartList}">去购物车结算</a>
        </div>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="col-lg-12">
            <div class="heading">
                <h2>相关商品</h2>
            </div>
        </div>
    </div>
    <div class="row" th:if="${products.isEmpty()}">
        <div class="text-center"><span>亲，没找到相关的宝贝</span></div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="products">
                <div class="col-lg-3 col-md-2 col-xs-12" th:each="product:${products}">
                    <div class="product" style="border: 1px solid gainsboro;">
                        <div class="image">
                            <a th:href="@{/product/{id}(id=${product.id})}"><img th:src="@{${product.imageUrl}}"
                                                                                 class="center-block"
                                                                                 style="width: 230px;height: 200px;"/></a>
                        </div>
                        <p style="margin-left: 5px; margin-top: 5px;"><span th:text="${product.name}">【订金预订省50】HUAWEI nova 6</span>
                        </p>
                        <p style="color: red; margin-left: 5px;"><span th:text="'￥'+${product.nowPrice}">3799.00</span>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>